package com.ecp.user.bean;

import com.ecp.commons.annotation.VariantType;
import com.ecp.commons.serialization.GenericBean;
import com.ecp.commons.serialization.Variant;

public class PayPasswordBinding extends GenericBean {
	public static final int	OPEN_YES	= 1;
	public static final int	OPEN_NO		= 0;

	@Override
	public void defineVariantSet() {
		this.entity = "tbl_paypasswordbinding";
		map.put("id", new Variant().setType(VariantType.INTEGER).setPk(true).setNullable(false));
		map.put("userId", new Variant().setType(VariantType.INTEGER));
		map.put("password", new Variant().setLength(0));
		map.put("open", new Variant().setType(VariantType.INTEGER));
	}
	
	@Override
	public boolean needCached() {
		return false;
	}

	@Override
	public void resetValues() {
		this.set("id", "");
		this.set("userId", "");
		this.set("password", "");
		this.set("open", "1");
	}

	public int getId() {
		return this.getInt("id");
	}

	public int getUserId() {
		return this.getInt("userId");
	}

	public String getPassword() {
		return this.getString("password");
	}

	public void setId(int id) {
		this.set("id", id);
	}

	public void setUserId(int userId) {
		this.set("userId", userId);
	}

	public void setPassword(String password) {
		this.set("password", password);
	}

	public void setOpen(int open) {
		this.set("open", open);
	}

	public int getOpen() {
		return this.getInt("open");
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + getId();
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PayPasswordBinding other = (PayPasswordBinding) obj;
		if (getId() != other.getId())
			return false;
		return true;
	}
}